package org.semanticflash.rdf.triple
{
	import org.semanticflash.rdf.utils.RDFTestBase;

	public class RDFTriplePatternTest extends RDFTestBase
	{





		public function test_instance( ):void
		{

			
			var tp_ab_:RDFTriplePattern = RDFTriplePattern.instance( iri("a"), iri("b"), "oVar" );
			var t_ab_:RDFTriple = RDFTriple.instance( iri("a"), iri("b"), null );
			
			assertEquals( tp_ab_.tripleMask, t_ab_ );
			assertEquals( tp_ab_.varNames.o, "oVar" );
								
		
		}


		
		public function test_getBindedCopy( ):void
		{
			
						
			var tp_ab_:RDFTriplePattern = RDFTriplePattern.instance( iri("a"), iri("b"), "oVar" );

			var bindings:Object = { oVar:iri("c") };			
					
			var bCopy:RDFTriplePattern = tp_ab_.getBindedCopy( bindings );

			assertEquals( bCopy.tripleMask, triple("abc") );			
			assertUndefined( bCopy.varNames.o ); // this var should no longer exists, it was binded

		
		}



		public function test_extractBindings( ):void
		{
		
			var tp_ab_:RDFTriplePattern = RDFTriplePattern.instance( iri("a"), iri("b"), "oVar" );
			
			var bindings:Object = tp_ab_.extractBindings( triple( "abc" ) );
		
			assertEquals( bindings.oVar, iri("c") );
		
		
		}




		
	}
}